﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="main.aspx.cs" Inherits="huaguwang.hgmanage.main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理后台首页</title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <link href="/css1/css_global.css" rel="stylesheet" type="text/css" />
    <link href="/css1/css_manage_main.css" rel="stylesheet" type="text/css" />
    <link href="/css1/style/blue/css_manage_pannel.css" rel="stylesheet" title="uistyle"
        type="text/css" />

    <script language="javascript" type="text/javascript" src="/js/jquery1.3.2.min.js"></script>

    <style type="text/css">
        img
        {
            behavior: url(/css1/iepngfix.htc);
        }
    </style>

    <script language="javascript" type="text/javascript">
        $(function() {
            var lockScreen = $("#lock_screen");
            var lockScreenForm = $("#lock_form");
            var lockStatu = false;
            var lockTip = $("#lock_tip")
            var unlockBtn = lockScreenForm.find("input.btn_unlock");
            var lockInpBox = lockScreenForm.find("input[name='lockPassword']");
            var doLock = $("#do_lock");
            var headerH = $("#header").height();
            var mainIframe = $("#control");
            var menuBox = $("#menu_box");
            var menuBoxW = menuBox.width();
            var mainBox = $("#main");
            var mainPadH = clearUnitSuffix(mainBox.css("paddingLeft")) + clearUnitSuffix(mainBox.css("paddingRight"));
            var mainPadV = clearUnitSuffix(mainBox.css("paddingTop")) + clearUnitSuffix(mainBox.css("paddingBottom"));
            var UIStyleBox = $("#tab_styles");
            var UIStyleSheet = $("link[title='uistyle']");
            var defaultUIStyle = UIStyleSheet.attr("href").match(/.?style\/([a-zA-Z]+)\/.+/)[1];
            var openLabelList = $("#label_list>ul");
            var openLabelNum = 0;
            var openLabelHistory = [];
            var siteLogo = $("#logo>img");
            initWindowSize();
            $(window).bind("resize", function(event) {
                initWindowSize();
                if (document.documentElement.clientWidth < 800) {

                }
            });
            //加载风格
            if (navigator.cookieEnabled && readCookie("uistyle")) {
                var myUIStyle = readCookie("uistyle");
                //默认风格
                UIStyleSheet.attr("href", "/css1/style/" + myUIStyle + "/css_manage_pannel.css");
                UIStyleBox.find("p." + myUIStyle).parent("li").addClass("on").siblings(".on").removeClass("on");
                siteLogo.attr("src", "/css1/style/" + myUIStyle + "/images/logo.jpg");
            } else {
                UIStyleSheet.attr("href", "/css1/style/" + defaultUIStyle + "/css_manage_pannel.css");
                UIStyleBox.find("p." + defaultUIStyle).parent("li").addClass("on").siblings(".on").removeClass("on");
                siteLogo.attr("src", "/css1/style/" + defaultUIStyle + "/images/logo.jpg");
            }
            //风格设置
            UIStyleBox.find("p").bind("click", function() {
                var me = $(this);
                var setStyle = me.attr("class");
                if (!navigator.cookieEnabled) {
                    alert("友情提示：您的浏览器没有开启cookie支持，自定义界面风格将在页面刷新后还原！");
                } else {
                    writeCookie("uistyle", me.attr("class"));
                };
                me.parent("li").addClass("on").siblings(".on").removeClass("on");
                UIStyleSheet.attr("href", "/css1/style/" + setStyle + "/css_manage_pannel.css"); ;
                siteLogo.attr("src", "/css1/style/" + setStyle + "/images/logo.jpg");
            });
            //cookie处理
            function writeCookie(name, value) {
                var expiresDate = new Date();
                var keepTime = 24 * 3600 * 1000;
                expiresDate.setTime(expiresDate.getTime() + keepTime);
                var cookieStr = name + "=" + escape(value) + ";expires=" + expiresDate.toGMTString();
                document.cookie = cookieStr;
            };
            function readCookie(name) {
                var cookieStr = document.cookie;
                var cookieArr = cookieStr.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
                if (cookieArr != null) return unescape(cookieArr[2]); return null;
            };
            function deleteCookie(name) {
                var exp = new Date();
                exp.setTime(exp.getTime() - 365 * 3600 * 1000);
                var cval = readCookie(name);
                if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
            };
            //
            function clearUnitSuffix(obj, unit) {
                if (!unit) unit = "px";
                if (obj.toLowerCase().indexOf(unit) != -1) {
                    return parseInt(obj.replace(unit, ""));
                } else {
                    return obj;
                }
            }
            //
            function initWindowSize() {
                menuBox.css("height", document.documentElement.clientHeight - headerH);
                $("#expand_bar").css("height", document.documentElement.clientHeight - headerH);
                mainIframe.css({ height: $(window).height() - headerH - mainPadV - 33, width: document.documentElement.clientWidth - menuBoxW - mainPadH - 4 });
            }
            //

            //
            var adminMenuGroup = $("div.menu_group");
            var adminMenus = $("div.menus");
            var posLevelFirst = $("#pos_first");
            var posLevelSecond = $("#pos_second");
            //菜单切换 去掉focus样式
            $("#menu_sorts").find("li").children("a").click(function() {
                var me = $(this);
                var meParent = me.parent("li");
                var meGoID = me.attr("goid");
                if (!meParent.hasClass("on")) {
                    meParent.addClass("on").siblings().filter(".on").removeClass("on");
                    posLevelFirst.text(me.text());
                    posLevelSecond.text("");
                    adminMenuGroup.filter("#" + meGoID).show().siblings().hide();
                };
                adminMenus.find("li.on").removeClass("on");
                if (meGoID == "mypannel") {
                } else {
                    return false;
                }
            });
            //
            $("#do_expand").click(function() {
                var me = $(this);
                if (me.hasClass("on")) {
                    var nowMainIframeW = mainIframe.width()
                    me.removeClass("on");
                    menuBox.hide();
                    $("#container").css("paddingLeft", "0px");
                    mainIframe.css("width", nowMainIframeW + menuBoxW);
                } else {
                    var nowMainIframeW = mainIframe.width()
                    me.addClass("on");
                    menuBox.show();
                    $("#container").css("paddingLeft", menuBoxW);
                    mainIframe.css("width", nowMainIframeW - menuBoxW);
                };
                return false;
            });
            //左侧单个菜单
            adminMenus.find("li").children("a").click(function() {
                $("body").focus();
                var me = $(this);
                var meParent = me.parent("li");
                var meTopMenu = me.parents("ul").prev("h6");
                if (!meParent.hasClass("on")) {
                    adminMenus.find("li.on").removeClass("on");
                    meParent.addClass("on");
                    posLevelSecond.html(meTopMenu.text() + "&nbsp;>&nbsp;" + me.text());
                };
                if (openLabelNum > 6) {
                    openLabelList.children("li").eq(0).empty();
                };
                $(meParent.html()).appendTo(openLabelList);
                openLabelList.children("li").eq(openLabelNum).prevAll().removeClass("on");
                openLabelNum++;
            });
            adminMenus.find("h6").click(function() {
                var me = $(this);
                var meParent = me.parents("div.menus");
                if (!meParent.hasClass("on")) {
                    meParent.addClass("on").children("ul").show();
                } else {
                    meParent.removeClass("on").children("ul").hide();
                }
            });
            //锁屏
            doLock.click(function() {
                lockScreen.css("height", document.documentElement.clientHeight);
                lockScreenForm.css("marginTop", (document.documentElement.clientHeight - 100) / 2);
                lockScreen.show();
                lockStatu = true;
                $(document).bind("keypress", function(event) {
                    if (event.keyCode == 13) {
                        unlockBtn.click();
                        return false;
                    };
                });
                unlockBtn.click(function() {
                    var lockInpPass = lockInpBox.val();
                    if ($.trim(lockInpPass) == "") {
                        lockTip.html("<b style='color:#ff0000'>解锁密码为空！</b>");
                    } else {
                        $.get("lockhelper.aspx", { pass: lockInpPass }, function(data) {
                            if (data == 1) {
                                lockScreen.hide();
                                lockTip.html("锁屏状态中，请输入密码解锁");
                                lockInpBox.val("");
                                lockStatu = false;
                            } else {
                                lockTip.html("<b style='color:#ff0000'>解锁密码不正确！</b>");
                            }
                        });
                    };
                });
                $(window).bind("unload", function() {
                    if (lockStatu) {
                        $.get("logout.aspx", function() {
                            return lockStatu = false;
                            window.reload();
                        });
                    };
                });
                return false;
            });

        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id="lock_screen">
        <div id="lock_form">
            <h6>
                <span id="lock_tip">锁屏状态中，请输入密码解锁</span></h6>
            <p>
                <label>
                    密码</label><input type="password" name="lockPassword" class="inp_text" /><input type="button"
                        class="btn_unlock" value="" /></p>
        </div>
    </div>
    <div id="header">
        <div id="logo">
            <img src="style/blue/images/logo.jpg" alt="" />
        </div>
        <div id="top_menu">
            <div id="ui_ms">
                <div id="user_info">
                    您好！<asp:Literal ID="Admin_user" runat="server"></asp:Literal>
                    [超级管理员]<span>|</span>[<a href="logout.aspx" title="" target="_top">退出</a>]<span>|</span><a
                        href="/index.aspx" title="华股在线首页" target="_self">站点首页</a><span>|</span> <a href="/user/index.aspx"
                            title="华股会员中心" target="_self">会员中心</a>
                </div>
                <div id="menu_sorts">
                    <ul>
                        <li><a href="servermsg.aspx" title="" target="control" goid="mypannel"><span>我的面板</span></a></li>
                        <%--<li><a href="javascript:void(0);" title="" goid="mymember"><span>用户管理</span></a></li>--%>
                        <li class="on"><a href="javascript:void(0);" title="" goid="mycontent"><span>内容</span></a></li>
                    </ul>
                </div>
            </div>
            <div id="gh_ts">
                <div id="get_help">
                    <img src="images/ico_lock_screen.png" style="margin-right: 4px; vertical-align: middle;"
                        alt="" /><a href="" id="do_lock" target="_blank">锁屏</a><span>|</span><a href="http://www.yixiantech.com"
                            title="逸仙软件网络科技" target="_blank">技术支持</a><span>|</span> <a href="#" title="" target="">
                                官方网站</a><span>|</span><a href="" title="" target="">帮助</a>
                </div>
                <div id="tab_styles">
                    <ul>
                        <li class="on">
                            <p class="blue">
                            </p>
                        </li>
                        <li>
                            <p class="black">
                            </p>
                        </li>
                        <li>
                            <p class="green">
                            </p>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div id="container">
        <div id="menu_box">
            <div class="menu_group" id="mypannel">
                <div class="menus on">
                    <h6>
                        个人信息<span class="expand"></span></h6>
                    <ul>
                        <li><a href="/hgmanage/power/user_epass.aspx" target="control" hidefocus="true">修改密码</a></li>
                    </ul>
                </div>
                <div class="menus on">
                    <h6>
                        系统操作<span class="expand"></span></h6>
                    <ul>
                        <li><a href="logout.aspx" target="_top">退出系统</a></li>
                    </ul>
                </div>
            </div>
            <div class="menu_group" id="mymember">
                <%--<div class="menus on">
                    <h6>
                        用户管理<span class="expand"></span></h6>
                    <ul>
                        <li><a href="system/admin_e.aspx" target="control" title="添加新用户" class="black_">添加新用户</a></li>
                        <li><a href="system/admin.aspx" target="control" title="用户管理" class="black_">用户管理</a></li>
                    </ul>
                </div>--%>
            </div>
            <div class="menu_group" id="mycontent" style="display: block;">
                <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
                    <ItemTemplate>
                        <div class="menus">
                            <h6> 
                                <%#Eval("name") %><span class="expand"></span></h6>
                            <ul>
                                <asp:Repeater ID="Repeater2" runat="server">
                                    <ItemTemplate>
                                        <li><a href="<%#Eval("url") %>" target="control">
                                            <%#Eval("name") %></a></li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
            </div>
        </div>
        <div id="main">
            <div id="expand_bar">
                <div class="pix_space">
                </div>
                <a href="" id="do_expand" class="on"><span></span></a>
            </div>
            <div id="topbar">
                <div id="position">
                    当前位置：<span id="pos_first">我的面板</span>&nbsp;>&nbsp; <span id="pos_second"></span>
                    <p id="quick_menu">
                        <a href="/hgmanage/main.aspx" target="">网站后台</a></p>
                </div>
            </div>
            <div id="content_wrap">
                <div id="content">
                    <iframe id="control" name="control" noresize="noresize" scrolling="yes" width="100%"
                        frameborder="0" style="overflow-x: hidden;" src="servermsg.aspx"></iframe>
                    <div id="label_tab">
                        <div id="label_list">
                        </div>
                        <div id="label_add">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
